package com.tjsinfo.tjsoa.system.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.tjsinfo.tjsoa.system.bo.ISystemPrivateGroupBO;

public class IsSamePrivateGroupNameAction extends Action {
	private ISystemPrivateGroupBO systemPrivateGroupBO;
	



	public ISystemPrivateGroupBO getSystemPrivateGroupBO() {
		return systemPrivateGroupBO;
	}




	public void setSystemPrivateGroupBO(ISystemPrivateGroupBO systemPrivateGroupBO) {
		this.systemPrivateGroupBO = systemPrivateGroupBO;
	}




	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		request.setCharacterEncoding("UTF-8");
		Integer id = Integer.parseInt(request.getParameter("id")); 
		String allgroupnaem = new String(request.getParameter("groupName").getBytes(
				"ISO-8859-1"), "UTF-8");
		
		if (systemPrivateGroupBO.isSameSystemPrivateGroupName(id,allgroupnaem)) {
			response.getWriter().print(false);
		} else {
			response.getWriter().print(true);
		}
		return null;
	}

}
